home *** CD-ROM | disk | FTP | other *** search
/ Run Magazine ReRun 1989 Special Issue / rerun-1989-special-issue.d64 / clock demo (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  1KB  |  37 lines

  1. 100 rem program 2 - tod clock alarm demo
  2. 110 rem
  3. 120 l(1)=1:l(2)=9:l(4)=5:l(5)=9:l(7)=5:l(8)=9:l(10)=9
  4. 130 poke53280,0:poke53281,0:print"[147][158]";
  5. 140 ifa=0thenprint"loading alarm.irq":a=1:load"alarm.irq",8,1
  6. 150 sys 49152
  7. 160 print"[159][147][158]1. set clock time"
  8. 170 print"2. set alarm time"
  9. 180 print"3. quit"
  10. 190 getb$:ifb$<"1"orb$>"3"then190
  11. 200 ifb$="1"thencb=0:t$="clock"
  12. 210 ifb$="2"thencb=128:t$="alarm"
  13. 220 ifb$="3"thenend
  14. 230 print"please enter the "t$" time":h=1:ap$="a":m=0:s=0
  15. 240 print"01:00:00.0a[157][157][157][157][157][157][157][157][157][157][157]";:tm$="01:00:00.0a":cp=1
  16. 250 print""mid$(tm$,cp,1)"[146][157]";
  17. 260 geta$:ifa$=""then260
  18. 270 ifa$=chr$(13)then380
  19. 280 ifa$=""then340
  20. 290 ifcp<11then320
  21. 300 ifa$<>"a"anda$<>"p"then260
  22. 310 gosub330:goto260
  23. 320 ifa$<"0"ora$>chr$(l(cp)+48)then260
  24. 330 tm$=left$(tm$,cp-1)+a$+right$(tm$,11-cp)
  25. 340 printmid$(tm$,cp,1);:cp=cp+1+11*(cp=11)
  26. 350 ifcp/3=int(cp/3)thenprint"";:cp=cp+1
  27. 360 ifcp=1thenprint"[157][157][157][157][157][157][157][157][157][157][157]";
  28. 370 goto250
  29. 380 poke56335,cb
  30. 390 ap$=right$(tm$,1):h=val(mid$(tm$,1,1))*16+val(mid$(tm$,2,1))
  31. 400 m=val(mid$(tm$,4,1))*16+val(mid$(tm$,5,1))
  32. 410 s=val(mid$(tm$,7,1))*16+val(mid$(tm$,8,1))
  33. 420 hp=-128*(ap$="p")+h:poke56331,hp
  34. 430 poke56330,m:poke56329,s:poke56328,val(mid$(tm$,10,1))
  35. 440 ifb$="2"thenpoke56333,136
  36. 450 goto160
  37.